package com.lry.basic.spring.ioc.test;

import com.lry.basic.spring.ioc.anno.Autowired;
import com.lry.basic.spring.ioc.anno.Bean;
import com.lry.basic.spring.ioc.anno.Component;
import com.lry.basic.spring.ioc.anno.Value;

/**
 * @author:刘仁有
 * @desc:
 * @email:953506233@qq.com
 * @data:2019/11/6
 */
@Component(value = "aBean",scope = "singleton",initMethod = "init",destroyMethod="destroy")
public class ABean {

    @Autowired
    private CBean cBean;
    @Value("lry")
    private String name;

    private int age;

    public ABean(){}

    @Autowired
    public ABean(@Value("100") int age){
        this.age = age;
    }

    @Bean
    private CBean getCBean(){
        return new CBean();
    }

    public void init(){
        System.out.println("init");
    }

    public void destroy(){
        System.out.println("destroy");
    }

    public int doSth(){
        System.out.println("do");
        return 1;
    }


}
